Forum Testowania i AutomatyzacjiKategoria: PytanieProblem z uruchomieniem testu po instalacji allure
Krzysiek KijasKrzysiek Kijas Personel zapytał 6 lat temu

Pytanie z kursy Podstawy Testów Automatycznych w Selenium i Python cz. 4 – Inteligentne czekanie i raporty:

Cześć,
Mam problem z uruchomieniem testu po instalacji allure. Mam taki błąd w konsoli

View post on imgur.com

Jak rozwiązać problem ? W google nic nie znalazlam poza info że to bug 🙂

Komenda : python -m pytest testsuit_all_tests.py

Traceback (most recent call last):
File “C:\Python\lib\runpy.py”, line 193, in _run_module_as_main
“__main__”, mod_spec)
File “C:\Python\lib\runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “C:\Python\lib\site-packages\pytest.py”, line 67, in
raise SystemExit(pytest.main())
File “C:\Python\lib\site-packages\_pytest\config\__init__.py”, line 55, in main
config = _prepareconfig(args, plugins)
File “C:\Python\lib\site-packages\_pytest\config\__init__.py”, line 180, in _prepareconfig
pluginmanager=pluginmanager, args=args
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 216, in
firstresult=hook.spec_opts.get(‘firstresult’),
File “C:\Python\lib\site-packages\pluggy\callers.py”, line 196, in _multicall
gen.send(outcome)
File “C:\Python\lib\site-packages\_pytest\helpconfig.py”, line 89, in pytest_cmdline_parse
config = outcome.get_result()
File “C:\Python\lib\site-packages\pluggy\callers.py”, line 76, in get_result
raise ex[1].with_traceback(ex[2])
File “C:\Python\lib\site-packages\pluggy\callers.py”, line 180, in _multicall
res = hook_impl.function(*args)
File “C:\Python\lib\site-packages\_pytest\config\__init__.py”, line 612, in pytest_cmdline_parse
self.parse(args)
File “C:\Python\lib\site-packages\_pytest\config\__init__.py”, line 777, in parse
self._preparse(args, addopts=addopts)
File “C:\Python\lib\site-packages\_pytest\config\__init__.py”, line 729, in _preparse
self.pluginmanager.load_setuptools_entrypoints(“pytest11”)
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 403, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File “C:\Python\lib\site-packages\_pytest\config\__init__.py”, line 286, in register
ret = super(PytestPluginManager, self).register(plugin, name)
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 254, in register
hook._maybe_apply_history(hookimpl)
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 650, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File “C:\Python\lib\site-packages\pluggy\__init__.py”, line 216, in
firstresult=hook.spec_opts.get(‘firstresult’),
File “C:\Python\lib\site-packages\pluggy\callers.py”, line 201, in _multicall
return outcome.get_result()
File “C:\Python\lib\site-packages\pluggy\callers.py”, line 76, in get_result
raise ex[1].with_traceback(ex[2])
File “C:\Python\lib\site-packages\pluggy\callers.py”, line 180, in _multicall
res = hook_impl.function(*args)
File “C:\Python\lib\site-packages\allure_pytest\plugin.py”, line 20, in pytest_addoption
help=”Generate Allure report in the specified directory (may not exist)”)
File “C:\Python\lib\site-packages\_pytest\config\argparsing.py”, line 296, in addoption
raise ValueError(“option names %s already added” % conflict)
ValueError: option names {‘–alluredir’} already added

Zawartość pliku tree.txt

C:.
| debug.log
| lost_hat_front_page_test.py
| lost_hat_login_page_tests.py
| lost_hat_product_page_tests.py
| lost_hat_smoke_tests.py
| testsuit_all_tests.py
| tree.txt
|
+—.idea
| jaktestowacDemoTests.iml
| misc.xml
| modules.xml
| workspace.xml
|
+—.pytest_cache
| \—v
| \—cache
| nodeids
|
+—helpers
| | functional_helpers.py
| |
| \—__pycache__
| functional_helpers.cpython-36.pyc
|
+—libs
| \—allure-2.7.0
| +—bin
| | allure
| | allure.bat
| |
| +—config
| | allure-cucumber.yml
| | allure-junit.yml
| | allure.yml
| |
| +—lib
| | | allure-commandline-2.7.0.jar
| | | allure-generator-2.7.0.jar
| | | allure-plugin-api-2.7.0.jar
| | | allure1-model-1.0.jar
| | | allure2-model-api-1.0.0.jar
| | | allure2-model-jackson-1.0.0.jar
| | | allure2-model-pojo-1.0.0.jar
| | | commons-beanutils-1.9.3.jar
| | | commons-codec-1.10.jar
| | | commons-collections-3.2.2.jar
| | | commons-collections4-4.1.jar
| | | commons-io-2.6.jar
| | | commons-lang3-3.7.jar
| | | commons-logging-1.2.jar
| | | commons-text-1.4.jar
| | | flexmark-0.34.8.jar
| | | flexmark-util-0.34.8.jar
| | | freemarker-2.3.28.jar
| | | httpclient-4.5.6.jar
| | | httpcore-4.4.10.jar
| | | jackson-annotations-2.9.0.jar
| | | jackson-core-2.9.6.jar
| | | jackson-databind-2.9.6.jar
| | | jackson-dataformat-xml-2.9.6.jar
| | | jackson-dataformat-yaml-2.9.6.jar
| | | jackson-module-jaxb-annotations-2.9.6.jar
| | | javax.servlet-api-3.1.0.jar
| | | jaxb-api-2.3.0.jar
| | | jaxb-utils-1.0.jar
| | | jcommander-1.72.jar
| | | jetty-http-9.4.11.v20180605.jar
| | | jetty-io-9.4.11.v20180605.jar
| | | jetty-server-9.4.11.v20180605.jar
| | | jetty-util-9.4.11.v20180605.jar
| | | log4j-1.2.17.jar
| | | opencsv-4.2.jar
| | | properties-2.0.RC5.jar
| | | slf4j-api-1.7.25.jar
| | | slf4j-log4j12-1.7.25.jar
| | | snakeyaml-1.18.jar
| | | stax2-api-3.1.4.jar
| | | tika-core-1.18.jar
| | | woodstox-core-5.0.3.jar
| | |
| | \—config
| | jetty-logging.properties
| | log4j.properties
| |
| \—plugins
| | README.txt
| |
| +—behaviors-plugin
| | | allure-plugin.yml
| | | plugin.jar
| | |
| | \—static
| | index.js
| |
| +—custom-logo-plugin
| | | allure-plugin.yml
| | |
| | \—static
| | custom-logo.svg
| | styles.css
| |
| +—junit-xml-plugin
| | allure-plugin.yml
| | junit-xml-plugin-2.7.0.jar
| |
| +—packages-plugin
| | | allure-plugin.yml
| | | plugin.jar
| | |
| | \—static
| | index.js
| |
| +—screen-diff-plugin
| | | allure-plugin.yml
| | |
| | \—static
| | index.js
| | styles.css
| |
| +—trx-plugin
| | allure-plugin.yml
| | trx-plugin-2.7.0.jar
| |
| +—xctest-plugin
| | | allure-plugin.yml
| | | xctest-plugin-2.7.0.jar
| | |
| | \—lib
| | xmlwise-1.2.11.jar
| |
| \—xunit-xml-plugin
| allure-plugin.yml
| xunit-xml-plugin-2.7.0.jar
|
\—__pycache__
lost_hat_smoke_tests.cpython-36.pyc
1 odpowiedzi
Krzysiek KijasKrzysiek Kijas Personel odpowiedział 6 lat temu

Niestety nie udało mi się na razie zreprodukować tego błędu 🙁
Poprosiłbym jeszcze o listę zainstalowanych pakietów (czyli wynik komendy pip list). Jest szansa, że może jakiś pakiet wchodzi w konflikt z pytest, allure-pytest oraz allure-python-commons (np. pytest-allure-adapter?), gdyż sama komenda python -m pytest testsuit_all_tests.py w żaden sposób sama nie wywołuje allure.

Krzysiek KijasKrzysiek Kijas Personel odpowiedział 6 lat temu

Świetnie 🙂 Nie ma sprawy 🙂

AvatarKatarzyna Kusiak odpowiedział 6 lat temu

Pomogło 🙂 Wielkie dzięki !

Krzysiek KijasKrzysiek Kijas Personel odpowiedział 6 lat temu

I jest i on pytest-allure-adaptor 😉
Znalazłem w kilku miejscach informacje, ze ten pakiet czasem gryzie się z pytest oraz
allure-pytest i w rezultacie powoduje błąd
ValueError: option names {‘–alluredir’} already added.

Spróbuj odinstalować ten pakiet a następnie spróbować odpalić testy. Jeśli to nie pomoże, wtedy spróbuj przeinstalować pakiety, które instalujemy w lekcji Instalacja pakietów przez PIP (lub Instalacja pakietów przez PyCharm ).

AvatarKatarzyna Kusiak odpowiedział 6 lat temu

Lista pakietów

allure-pytest (2.5.2)
allure-python-commons (2.5.2)
atomicwrites (1.1.5)
attrs (18.1.0)
beautifulsoup4 (4.6.1)
certifi (2018.4.16)
cffi (1.11.5)
chardet (3.0.4)
click (6.7)
colorama (0.3.9)
enum34 (1.1.6)
example (0.1.0)
Faker (0.9.1)
Flask (1.0.2)
gevent (1.3.5)
greenlet (0.4.14)
idna (2.7)
itsdangerous (0.24)
Jinja2 (2.10)
locustio (0.8.1)
lxml (4.2.3)
MarkupSafe (1.0)
more-itertools (4.2.0)
msgpack-python (0.5.6)
namedlist (1.7)
nose-testconfig (0.10)
pip (9.0.1)
pluggy (0.6.0)
py (1.5.4)
pycparser (2.18)
pytest (3.6.3)
pytest-allure-adaptor (1.7.10)
pytest-html (1.19.0)
pytest-metadata (1.7.0)
python-dateutil (2.7.3)
PyYAML (3.12)
pyzmq (17.1.2)
requests (2.19.1)
result (0.3.0)
selenium (3.14.1)
setuptools (28.8.0)
six (1.11.0)
terminal (0.4.0)
text-unidecode (1.2)
typing (3.6.4)
urllib3 (1.23)
Werkzeug (0.14.1)